#include <iostream>
using namespace std;

int whichDay(int year, int month, int day)
{
    if (month == 1 || month == 2) {
        month += 12;
        year -= 1;
    }

    int century = year / 100;
    year %= 100;
    int week = year + (year / 4) + (century / 4) - 2 * century +
        26 * (month + 1) / 10 + day - 1;

    week = (week % 7 + 7) % 7;
    if (week == 0) {
        week = 7;
    }
    return week;
}

void getAllDay(int year)
{
    for (int month = 1; month < 13; ++month)
    {
        int week = whichDay(year, month, 1);
        if (month == 1)
        {
            int MaDingDay = 9 - week + 2 * 7;
            printf("%4d-%02d-%02d\n", year, month, 1);
            printf("%4d-%02d-%02d\n", year, month, MaDingDay);
        }
        else if (month == 2)
        {
            int PresidentDay = 9 - week + 2 * 7;
            printf("%4d-%02d-%02d\n", year, month, PresidentDay);
        }
        else if (month == 5)
        {
            int SoliderDay = 31;
            while (whichDay(year, month, SoliderDay) != 1)
                --SoliderDay;

            printf("%4d-%02d-%02d\n", year, month, SoliderDay);
        }
        else if (month == 7)
        {
            printf("%4d-%02d-%02d\n", year, month, 4);
        }
        else if (month == 9)
        {
            int WorkerDay = 1;
            while (whichDay(year, month, WorkerDay) != 1)
                ++WorkerDay;
            printf("%4d-%02d-%02d\n", year, month, WorkerDay);
        }
        else if (month == 11)
        {
            int SuperDay = (5 - week >= 1 ? 5 - week : 12 - week) + 3 * 7;

            printf("%4d-%02d-%02d\n", year, month, SuperDay);
        }
        else if (month == 12)
        {
            printf("%4d-%02d-%02d\n", year, month, 25);
        }
    }
}

int main()
{


    int year = 0;
    while (cin >> year)
    {
        getAllDay(year);
        cout << endl;
    }

    return 0;
}